package com.gilight.base.uiapp.order;

import com.gilight.base.base.exception.ServiceException;
import com.gilight.base.dto.freight.ShipTraceDTO;
import com.gilight.base.dto.order.OrderDTO;
import com.gilight.base.dto.order.OrderRequestDTO;
import com.gilight.base.dto.uni.UserDTO;
import com.gilight.base.model.Page;
import com.gilight.base.model.order.OrderSkuDO;

import java.util.List;
import java.util.Map;


/**订单服务
 * Created by rize on 2019/7/4.
 */
public interface OrderService {

    /**
     *
     * @param orderRequest  订单请求实例
     * @param channel       订单提交渠道
     * @param userId
     * @param zzjgId
     * @param isBaiHuo
     * @param userDTO
     * @return
     * @throws ServiceException
     */
    public String takeOrder(
            OrderRequestDTO orderRequest,
            String channel,
            Long userId, Long zzjgId, Integer isBaiHuo, UserDTO userDTO,String ipRegion) throws ServiceException;

    /**
     * 获取订单分页
     * @param pageNo
     * @param pageSize
     * @param status 订单状态
     * @param userId
     * @return
     * @throws ServiceException
     */

    public Page<OrderDTO> getOrderPage(
            Integer pageNo,
            Integer pageSize,
            Integer status,
            Long userId,
            List<Long> zzjgIds) throws ServiceException;

    public Page<OrderDTO> getOrderPageStatus(
            Integer pageNo,
            Integer pageSize,
            List<Integer> status,
            Long userId,
            List<Long> zzjgIds) throws ServiceException;
    /**
     * 获取订单详情
     * @param orderId
     * @param userId
     * @param orderNo
     * @return
     * @throws ServiceException
     */
    public OrderDTO getOrderDetail(
            Long orderId,
            Long userId, String orderNo) throws ServiceException;

    /**微信小程序预先支付
     *
     * @param parentOrderNo 父单串号
     * @param orderNo       订单串号
     * @param ip            ip地址
     * @param userId        用户Id
     * @param userDTO
     * @return
     * @throws ServiceException
     */
    public Object wxPrepay(
            String parentOrderNo,
            String orderNo,
            String ip,
            Long userId,
            Long zzjgId, UserDTO userDTO) throws ServiceException;
    public Object downWxBill(
            Long zzjgId,String date) throws ServiceException;
    /**线下支付
     *
     * @param parentOrderNo
     * @param orderNo
     * @param userId
     * @return
     * @throws ServiceException
     */
    public Object offlinePrepay(
            String parentOrderNo,
            String orderNo,
            Long userId) throws ServiceException;

    /**用户申请退款
     *
     * @param orderNo 订单串号
     * @param reason  退款理由
     * @param userId
     * @return
     * @throws ServiceException
     */
    public String refund(
            String orderNo,
            String reason,
            Long userId) throws ServiceException;

    /**
     *
     * @param orderNo   取消订单
     * @param userId
     * @return
     * @throws ServiceException
     */
    public String cancel(
            String orderNo,
            Long userId) throws ServiceException;

    /**
     * 确认订单
     * @param orderNo
     * @param userId
     * @return
     * @throws ServiceException
     */
    public String confirm(
            String orderNo,
            Long userId) throws ServiceException;

    /**
     * 查询物流
     * @param orderNo
     * @param userId
     * @return
     * @throws ServiceException
     */
    public ShipTraceDTO queryShip(
            String orderNo,
            Long userId) throws ServiceException;

    /**
     * 预览邮费
     * @param orderRequest  用户欲下单
     * @param userId
     * @return
     * @throws ServiceException
     */
    public Integer previewFreight(
            OrderRequestDTO orderRequest,
            Long userId) throws ServiceException;

    public List<Map<String,Object>> getInCook(Long zzjgId);

    List<Map<String, Object>> getOrderSku(String orderNo);
}
